//
//  SQNewViewController.m
//  energy
//
//  Created by 苏青 on 2021/10/11.
//

#import "SQNewViewController.h"
#import "SQNewModel.h"
#import "SQNewDetailsViewController.h"

@interface SQNewViewController ()<BaseTableVCInterface>

@end

@implementation SQNewViewController

- (void)viewDidLoad {
    self.tableViewInterface = self;
    [super viewDidLoad];
    self.navigationItem.title = @"新闻公告";
    [self getNewData];
    
//    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getReleaseData) name:@"addRelease" object:nil];
    
    self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        [self getNewData];
    }];
    
    
}

-(void)getNewData{
    [SQNewModel getDataWithParams:@{@"ae_e":MEnterpriseId,@"a_type":@"0"} WithCallBack:^(SQNewModel * data) {
        [self detailModelwithArr:data.data withCallBack:nil];
        [self reloadTableView];
        
    }];
}

-(BaseModel *)modelForCell:(NSIndexPath *)indexPath{
    return self.dataSouece[indexPath.row];
}



-(NSInteger)rowsCount:(NSInteger)section{
    return self.dataSouece.count;
}


- (NSArray<NSArray<NSString *> *> *)classArr{
    return @[@[@"SQNewTableViewCell"]];
}

- (void)tableViewSelectAtIndexPath:(NSIndexPath *)indexPath{
    SQNewModelData * dataModel = self.dataSouece[indexPath.row];
    SQNewDetailsViewController * newDetailsVC = SQNewDetailsViewController.new;
    newDetailsVC.a_id = dataModel.a_id;
    [self pushVC:newDetailsVC];
}


@end
